﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Vortex.Drawing {

	/// <summary>
	/// CanvasBrush contains information about 2nd level primitive shading. It helps apply pattern to simple primitives 
	/// </summary>
	public abstract class CanvasBrush {
		protected BaseTexture _patternTexture;
		protected Rect _region;
		protected Rect _transformedRegion;

		protected CanvasBrush() {
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="CanvasBrush"/> class.
		/// </summary>
		/// <param name="texture">The texture pattern.</param>
		/// <param name="region">The untransformed region.</param>
		protected CanvasBrush(BaseTexture texture, Rect region) {
			_patternTexture = texture;
			_region = region;
			texture.Transform(ref region, out _transformedRegion);
		}

		/// <summary>
		/// Gets the pattern texture for this brush.
		/// </summary>
		/// <value>The pattern brush.</value>
		public BaseTexture Pattern {
			get { return _patternTexture; }
		}

		/// <summary>
		/// Gets the region of pattern to map on primitives.
		/// </summary>
		/// <value>The pattern region.</value>
		public Rect Region {
			get { return _region; }
		}

		/// <summary>
		/// Gets the transformed region of pattern to map on primitives.
		/// </summary>
		/// <value>Transformed pattern region.</value>
		public Rect TransformedRegion {
			get { return _transformedRegion; }
		}

		/// <summary>
		/// Default brush, no additional shading for 2nd texture level
		/// </summary>
		public static readonly CanvasBrush Default = null;
	}

}
